<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta http-equiv="Content-Style-Type" content="text/css">
  <title></title>
  <meta name="Generator" content="Cocoa HTML Writer">
  <meta name="CocoaVersion" content="824.41">
  <style type="text/css">
    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000}
    p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica; min-height: 22.0px}
    p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica}
    p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
    p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
    p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #bf0000}
    p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
    p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
    p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #0000bf; min-height: 12.0px}
    p.p10 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #0000bf}
    span.s1 {color: #0000bf}
    span.s2 {color: #007300}
    span.Apple-tab-span {white-space:pre}
  </style>
</head>
<body>
<p class="p1">//SLUGens released under the GNU GPL as extensions for SuperCollider 3, by Nick Collins, http://www.informatics.sussex.ac.uk/users/nc81/</p>
<p class="p2"><b></b><br></p>
<p class="p3"><b>DoubleWell2<span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>Forced DoubleWell Oscillator</b></p>
<p class="p2"><b></b><br></p>
<p class="p4"><b>DoubleWell2.ar(reset,ratex,ratey,f,w,delta,initx,inity, mul, add)</b></p>
<p class="p5"><br></p>
<p class="p4">Improved Euler ODE solver implementation of the chaotic Forced Double Well Oscillator (see Strogatz, Steven H. (1994) Nonlinear Dynamics and Chaos. Addison-Wesley, Reading, MA. pp441-7).<span class="Apple-converted-space"> </span></p>
<p class="p5"><br></p>
<p class="p4">D2x +delta*Dx-x+x^3 = F*cos(w*t)</p>
<p class="p5"><br></p>
<p class="p4">y = Dx</p>
<p class="p5"><br></p>
<p class="p4">All inputs can have .kr rate UGens plugged in.</p>
<p class="p5"><br></p>
<p class="p4"><b>reset</b>- restart with new initial conditions sampled from initx, inity</p>
<p class="p4"><b>ratex</b>- update rate for x</p>
<p class="p4"><b>ratey</b>- update rate for y<span class="Apple-converted-space"> </span></p>
<p class="p4"><b>f-</b> equation constant</p>
<p class="p4"><b>w</b>- equation constant</p>
<p class="p4"><b>delta</b>- equation constant</p>
<p class="p4"><b>initx</b>- reset value for x</p>
<p class="p4"><b>inity</b>- reset value for y</p>
<p class="p5"><br></p>
<p class="p4">note for me- add a t rate control? or arbitary oscillator input rather than Fcos(wt)</p>
<p class="p5"><br></p>
<p class="p6">//Can be very noisy, high pitched and aliases badly- ie great fun, but watch out for your ears, filter, try out odd param settings. I've turned all the amplitudes down in the following</p>
<p class="p7"><br></p>
<p class="p7"><br></p>
<p class="p1">//defaults, high pitched! WARNING</p>
<p class="p8">{<span class="s1">Out</span>.ar(0,<span class="s1">Pan2</span>.ar(0.1*<span class="s1">DoubleWell</span>.ar(Impulse.kr(0),MouseX.kr(0.01,1,<span class="s2">'exponential'</span>),MouseY.kr(0.01,1,<span class="s2">'exponential'</span>),0.9,0.0001,0.25,<span class="s1">LFNoise0</span>.kr(1,0.4,0.5),<span class="s1">LFNoise0</span>.kr(1,0.4,0.5)),0.0))}.play</p>
<p class="p7"><br></p>
<p class="p7"><br></p>
<p class="p1">//2 per second</p>
<p class="p1">(</p>
<p class="p8">{<span class="s1">Out</span>.ar(0,<span class="s1">Pan2</span>.ar(</p>
<p class="p9"><br></p>
<p class="p10">CombN.ar(</p>
<p class="p8"><span class="s1">Resonz.ar(DoubleWell2</span>.ar(Impulse.kr(2),MouseX.kr(0.01,0.1,<span class="s2">'exponential'</span>),MouseY.kr(0.01,0.1,<span class="s2">'exponential'</span>),3.9,MouseX.kr(0.0001,0.01,<span class="s2">'exponential'</span>),0.25,<span class="s1">LFNoise0</span>.kr(1,0.4,0.5),<span class="s1">LFNoise0</span>.kr(1,10.4,10.5)),1000,0.1),</p>
<p class="p8">0.05,0.05,2</p>
<p class="p8">)</p>
<p class="p8">,0.0))}.play</p>
<p class="p8">)</p>
<p class="p7"><br></p>
<p class="p7"><br></p>
<p class="p7"><br></p>
<p class="p1">//plotting check of first samples</p>
<p class="p8">{<span class="s1">DoubleWell2</span>.ar(0,0.1,0.1,0.4,1,0.25,0,0.0)}.plot(0.05, minval:-1, maxval:1)</p>
<p class="p7"><br></p>
<p class="p1">//gradually changing force</p>
<p class="p8">{<span class="s1">DoubleWell2</span>.ar(0,0.1,0.1,<span class="s1">Line</span>.kr(0.01,0.8,10),1,0.25,0,0.0)}.play</p>
<p class="p7"><br></p>
<p class="p7"><br></p>
<p class="p1">//controlling force- guitar feedback!</p>
<p class="p8">{<span class="s1">DoubleWell2</span>.ar(0,0.1,0.1,<span class="s1">MouseX.kr(0.0,10.0)</span>,1,MouseY.kr(0.0,1.0),0,0.0)}.play</p>
<p class="p7"><br></p>
<p class="p8">//triggering</p>
<p class="p8">{<span class="s1">DoubleWell2</span>.ar(Impulse.kr(MouseY.kr(1,10, 'exponential')),0.1,0.1,<span class="s1">MouseX.kr(0.0,10.0)</span>,1,MouseY.kr(0.0,1.0),LFNoise0.kr(2.3,0.2,0.8),LFNoise1.kr(2.37,0.2,0.8))}.play</p>
<p class="p7"><br></p>
<p class="p7"><br></p>
<p class="p1">//overload patch</p>
<p class="p8">{<span class="s1">DoubleWell2</span>.ar(<span class="s1">Dust</span>.kr(<span class="s1">LFNoise0</span>.kr(0.5,0.2,0.4)),0.1,0.1,<span class="s1">MouseX</span>.kr(0.0,50.0),<span class="s1">MouseY</span>.kr(0.0,1.0),0.25, <span class="s1">LFNoise0</span>.kr(2.3,0.4,0.5),<span class="s1">LFNoise1</span>.kr(2.37,0.4,0.2))}.play</p>
<p class="p7"><br></p>
<p class="p7"><br></p>
</body>
</html>
